/*
 * $Id: multicast.h,v 1.29.6.4 Broadcom SDK $
 * 
 * $Copyright: Copyright 2011 Broadcom Corporation.
 * This program is the proprietary software of Broadcom Corporation
 * and/or its licensors, and may only be used, duplicated, modified
 * or distributed pursuant to the terms and conditions of a separate,
 * written license agreement executed between you and Broadcom
 * (an "Authorized License").  Except as set forth in an Authorized
 * License, Broadcom grants no license (express or implied), right
 * to use, or waiver of any kind with respect to the Software, and
 * Broadcom expressly reserves all rights in and to the Software
 * and all intellectual property rights therein.  IF YOU HAVE
 * NO AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE
 * IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE
 * ALL USE OF THE SOFTWARE.  
 *  
 * Except as expressly set forth in the Authorized License,
 *  
 * 1.     This program, including its structure, sequence and organization,
 * constitutes the valuable trade secrets of Broadcom, and you shall use
 * all reasonable efforts to protect the confidentiality thereof,
 * and to use this information only in connection with your use of
 * Broadcom integrated circuit products.
 *  
 * 2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS
 * PROVIDED "AS IS" AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES,
 * REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY,
 * OR OTHERWISE, WITH RESPECT TO THE SOFTWARE.  BROADCOM SPECIFICALLY
 * DISCLAIMS ANY AND ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY,
 * NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES,
 * ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
 * CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING
 * OUT OF USE OR PERFORMANCE OF THE SOFTWARE.
 * 
 * 3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL
 * BROADCOM OR ITS LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL,
 * INCIDENTAL, SPECIAL, INDIRECT, OR EXEMPLARY DAMAGES WHATSOEVER
 * ARISING OUT OF OR IN ANY WAY RELATING TO YOUR USE OF OR INABILITY
 * TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF
 * THE AMOUNT ACTUALLY PAID FOR THE SOFTWARE ITSELF OR USD 1.00,
 * WHICHEVER IS GREATER. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING
 * ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.$
 * 
 * DO NOT EDIT THIS FILE!
 * This file is auto-generated.
 * Edits to this file will be lost when it is regenerated.
 */

#ifndef __BCM_MULTICAST_H__
#define __BCM_MULTICAST_H__

#include <bcm/types.h>

#define BCM_MULTICAST_INVALID   0          

/* Mulicast flags. */
#define BCM_MULTICAST_WITH_ID               0x00000001 
#define BCM_MULTICAST_TYPE_L2               0x00010000 
#define BCM_MULTICAST_TYPE_L3               0x00020000 
#define BCM_MULTICAST_TYPE_VPLS             0x00040000 
#define BCM_MULTICAST_TYPE_SUBPORT          0x00080000 
#define BCM_MULTICAST_TYPE_MIM              0x00100000 
#define BCM_MULTICAST_TYPE_WLAN             0x00200000 
#define BCM_MULTICAST_TYPE_VLAN             0x00400000 
#define BCM_MULTICAST_TYPE_TRILL            0x00800000 
#define BCM_MULTICAST_TYPE_NIV              0x01000000 
#define BCM_MULTICAST_TYPE_EGRESS_OBJECT    0x02000000 
#define BCM_MULTICAST_TYPE_MASK             0x02ff0000 
#define BCM_MULTICAST_DISABLE_SRC_KNOCKOUT  0x00000002 

#ifndef BCM_HIDE_DISPATCHABLE

/* Initialize the multicast module. */
extern int bcm_multicast_init(
    int unit);

/* Shut down (uninitialize) the multicast module. */
extern int bcm_multicast_detach(
    int unit);

/* bcm_multicast_create */
extern int bcm_multicast_create(
    int unit, 
    uint32 flags, 
    bcm_multicast_t *group);

/* bcm_multicast_destroy */
extern int bcm_multicast_destroy(
    int unit, 
    bcm_multicast_t group);

/* bcm_multicast_fabric_distribution_set */
extern int bcm_multicast_fabric_distribution_set(
    int unit, 
    bcm_multicast_t group, 
    bcm_fabric_distribution_t ds_id);

/* bcm_multicast_fabric_distribution_get */
extern int bcm_multicast_fabric_distribution_get(
    int unit, 
    bcm_multicast_t group, 
    bcm_fabric_distribution_t *ds_id);

/* bcm_multicast_l3_encap_get */
extern int bcm_multicast_l3_encap_get(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_if_t intf, 
    bcm_if_t *encap_id);

/* bcm_multicast_l2_encap_get */
extern int bcm_multicast_l2_encap_get(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_vlan_t vlan, 
    bcm_if_t *encap_id);

/* bcm_multicast_vpls_encap_get */
extern int bcm_multicast_vpls_encap_get(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_gport_t mpls_port_id, 
    bcm_if_t *encap_id);

/* bcm_multicast_trill_encap_get */
extern int bcm_multicast_trill_encap_get(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_if_t intf, 
    bcm_if_t *encap_id);

/* bcm_multicast_subport_encap_get */
extern int bcm_multicast_subport_encap_get(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_gport_t subport, 
    bcm_if_t *encap_id);

/* bcm_multicast_mim_encap_get */
extern int bcm_multicast_mim_encap_get(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_gport_t mim_port_id, 
    bcm_if_t *encap_id);

/* bcm_multicast_wlan_encap_get */
extern int bcm_multicast_wlan_encap_get(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_gport_t wlan_port_id, 
    bcm_if_t *encap_id);

/* bcm_multicast_vlan_encap_get */
extern int bcm_multicast_vlan_encap_get(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_gport_t vlan_port_id, 
    bcm_if_t *encap_id);

/* bcm_multicast_niv_encap_get */
extern int bcm_multicast_niv_encap_get(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_gport_t niv_port_id, 
    bcm_if_t *encap_id);

/* bcm_multicast_egress_object_encap_get */
extern int bcm_multicast_egress_object_encap_get(
    int unit, 
    bcm_multicast_t group, 
    bcm_if_t intf, 
    bcm_if_t *encap_id);

/* bcm_multicast_egress_add */
extern int bcm_multicast_egress_add(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_if_t encap_id);

/* bcm_multicast_egress_subscriber_add */
extern int bcm_multicast_egress_subscriber_add(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_if_t encap_id, 
    bcm_gport_t subscriber_queue);

/* bcm_multicast_egress_delete */
extern int bcm_multicast_egress_delete(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_if_t encap_id);

/* bcm_multicast_egress_subscriber_delete */
extern int bcm_multicast_egress_subscriber_delete(
    int unit, 
    bcm_multicast_t group, 
    bcm_gport_t port, 
    bcm_if_t encap_id, 
    bcm_gport_t subscriber_queue);

/* bcm_multicast_egress_delete_all */
extern int bcm_multicast_egress_delete_all(
    int unit, 
    bcm_multicast_t group);

/* bcm_multicast_egress_set */
extern int bcm_multicast_egress_set(
    int unit, 
    bcm_multicast_t group, 
    int port_count, 
    bcm_gport_t *port_array, 
    bcm_if_t *encap_id_array);

/* bcm_multicast_egress_subscriber_set */
extern int bcm_multicast_egress_subscriber_set(
    int unit, 
    bcm_multicast_t group, 
    int port_count, 
    bcm_gport_t *port_array, 
    bcm_if_t *encap_id_array, 
    bcm_gport_t *subscriber_queue_array);

/* bcm_multicast_egress_get */
extern int bcm_multicast_egress_get(
    int unit, 
    bcm_multicast_t group, 
    int port_max, 
    bcm_gport_t *port_array, 
    bcm_if_t *encap_id_array, 
    int *port_count);

/* bcm_multicast_egress_subscriber_get */
extern int bcm_multicast_egress_subscriber_get(
    int unit, 
    bcm_multicast_t group, 
    int port_max, 
    bcm_gport_t *port_array, 
    bcm_if_t *encap_id_array, 
    bcm_gport_t *subscriber_queue_array, 
    int *port_count);

/* Assign a set of VLANs as the selected port's replication list. */
extern int bcm_multicast_repl_set(
    int unit, 
    int mc_index, 
    bcm_port_t port, 
    bcm_vlan_vector_t vlan_vec);

/* Return set of VLANs selected for port's replication list. */
extern int bcm_multicast_repl_get(
    int unit, 
    int index, 
    bcm_port_t port, 
    bcm_vlan_vector_t vlan_vec);

/* Retrieve the flags associated with a mulitcast group. */
extern int bcm_multicast_group_get(
    int unit, 
    bcm_multicast_t group, 
    uint32 *flags);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Callback function for bcm_multicast_group_traverse. */
typedef int (*bcm_multicast_group_traverse_cb_t)(
    int unit, 
    bcm_multicast_t group, 
    uint32 flags, 
    void *user_data);

#ifndef BCM_HIDE_DISPATCHABLE

/* 
 * Iterate over the defined multicast groups of the type specified in
 * 'flags'.  If all types are desired, use MULTICAST_TYPE_MASK.
 */
extern int bcm_multicast_group_traverse(
    int unit, 
    bcm_multicast_group_traverse_cb_t trav_fn, 
    uint32 flags, 
    void *user_data);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Multicast group controls. */
typedef enum bcm_multicast_control_e {
    bcmMulticastControlMtu  /* Maximum transmission unit. */
} bcm_multicast_control_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* Set multicast group control. */
extern int bcm_multicast_control_set(
    int unit, 
    bcm_multicast_t group, 
    bcm_multicast_control_t type, 
    int arg);

/* Get multicast group control. */
extern int bcm_multicast_control_get(
    int unit, 
    bcm_multicast_t group, 
    bcm_multicast_control_t type, 
    int *arg);

#endif /* BCM_HIDE_DISPATCHABLE */

#endif /* __BCM_MULTICAST_H__ */
